Detect the agent CLIs installed on your machine and reuse the logins they already hold, so you don't sign in to the same providers twice.
Ships two things:
- A plugin that reports which CLIs are installed and signed in, and imports their credentials into OpenCode.
- opencode-provider-claude-code — a provider that runs the
local Claude Code CLI, so
claude-code/*models appear in/models.
| CLI | id | Importable into |
|---|---|---|
| Claude Code | claude |
— |
| Codex | codex |
openai |
| Gemini CLI | gemini |
google |
| Antigravity | antigravity |
— |
| Qwen Code | qwen |
— |
| Cursor Agent | cursor-agent |
— |
| GitHub Copilot CLI | copilot |
— |
| OpenCode | opencode |
— |
Claude Code also resolves through the openclaude fork. CLIs without an import
target keep their credential somewhere unreadable (the OS keyring) or have no
matching OpenCode provider — their sign-in state is still reported.
Each CLI honours a <NAME>_BIN environment variable pointing at an absolute
path: CLAUDE_BIN, CODEX_BIN, GEMINI_BIN, AGY_BIN, QWEN_BIN,
CURSOR_AGENT_BIN, COPILOT_BIN, OPENCODE_BIN.
OpenCode loads flat .ts files from its plugins directory, so the install is a
clone plus a one-line entry file.
git clone https://github.com/shadowraven69/opencode-cli-auth.git ~/opencode-cli-auth && \
mkdir -p ~/.config/opencode/plugins && \
echo 'export * from "../../../opencode-cli-auth/src/index.ts"' > ~/.config/opencode/plugins/cli-auth.tsThe relative path works the same on Linux, macOS, and Windows. Clone elsewhere if
you like — just keep the entry file pointing at src/index.ts inside the clone.
Install the
opencode-cli-authplugin into OpenCode for me.
- Clone
https://github.com/shadowraven69/opencode-cli-authto~/opencode-cli-auth.- OpenCode only loads FLAT
.tsfiles from its plugins directory — a folder with anindex.tsis ignored — so create~/.config/opencode/plugins/cli-auth.tscontaining exactly one line:export * from "../../../opencode-cli-auth/src/index.ts"- Do not overwrite that file if it already exists; show it to me instead.
- Verify with
opencode models > /dev/null && echo ok.Do not add anything to my
opencode.json; this plugin needs no config.
opencode models > /dev/null && echo okTwo tools, callable by the agent.
cli_auth_status — which CLIs are installed, where, whether each is signed
in, and which logins can be imported.
| Argument | Type | Purpose |
|---|---|---|
only |
string[] |
Restrict the scan to specific CLI ids |
includeSearchPath |
boolean |
List every directory that was searched |
cli_auth_import — copy one CLI's login into OpenCode.
| Argument | Type | Purpose |
|---|---|---|
cli |
string |
CLI id to import from |
Importing replaces whatever credential that provider currently holds. Run
cli_auth_statusfirst.
From a terminal, without involving OpenCode:
node --experimental-strip-types scripts/smoke.tsInstalled but reported not-on-path — run cli_auth_status with
includeSearchPath: true, then pin it: export CODEX_BIN="/abs/path/to/codex".
Reported shim-broken — the wrapper resolved but its target is gone, usually
a leftover shim from an uninstalled version. Reinstall, or pin <NAME>_BIN.
auth=unknown for Gemini or Qwen — expected. Neither exposes a safe status
command, so state is inferred from their credential file. Sign in once and it
appears.
Tools don't show up — the module failed to load. Check with
opencode models > /dev/null && echo ok.
MIT